namespace AgorApp.Roma.Model.DataTransferObjects
{
    using AgorApp.Roma.Model.DataTransferObjects.Utils;
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// 
    /// </summary>
    public class ConsiglieriImages : IEntityObjectState, IEquatable<ConsiglieriImages>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ConsiglieriImages"/> class.
        /// </summary>
        public ConsiglieriImages()
        {
            this.IdImage = IntIdKeeper.Next();
            this.IdConsigliere = ShortIdKeeper.Next();
            this.DataInserimento = DateTimeOffset.Now;
            this.UtenteInserimento = "System";
        }

        /// <summary>
        /// Gets or sets the identifier image.
        /// </summary>
        /// <value>
        /// The identifier image.
        /// </value>
        public int IdImage { get; set; }
        /// <summary>
        /// Gets or sets the identifier consigliere.
        /// </summary>
        /// <value>
        /// The identifier consigliere.
        /// </value>
        public short IdConsigliere { get; set; }
        /// <summary>
        /// Gets or sets the name of the image.
        /// </summary>
        /// <value>
        /// The name of the image.
        /// </value>
        public string ImageName { get; set; }
        /// <summary>
        /// Gets or sets the image ext.
        /// </summary>
        /// <value>
        /// The image ext.
        /// </value>
        public string ImageExt { get; set; }
        /// <summary>
        /// Gets or sets the image file.
        /// </summary>
        /// <value>
        /// The image file.
        /// </value>
        public byte[] ImageFile { get; set; }
        /// <summary>
        /// Gets or sets the data inserimento.
        /// </summary>
        /// <value>
        /// The data inserimento.
        /// </value>
        public System.DateTimeOffset DataInserimento { get; set; }
        /// <summary>
        /// Gets or sets the utente inserimento.
        /// </summary>
        /// <value>
        /// The utente inserimento.
        /// </value>
        public string UtenteInserimento { get; set; }
        /// <summary>
        /// Gets or sets the data fine validita record.
        /// </summary>
        /// <value>
        /// The data fine validita record.
        /// </value>
        public Nullable<System.DateTimeOffset> DataFineValiditaRec { get; set; }
        /// <summary>
        /// Gets or sets the utente cancellazione record.
        /// </summary>
        /// <value>
        /// The utente cancellazione record.
        /// </value>
        public string UtenteCancellazioneRec { get; set; }

        #region Related Entities
        /// <summary>
        /// Gets or sets the consigliere.
        /// </summary>
        /// <value>
        /// The consigliere.
        /// </value>
        public virtual ConsiglieriAssemblea Consigliere { get; set; }
        #endregion

        /// <summary>
        /// Gets or sets the state of the object.
        /// </summary>
        /// <value>
        /// The state of the object.
        /// </value>
        public EntityObjectState ObjectState { get; set; }

        #region IEquatable
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
        /// </returns>
        public bool Equals(ConsiglieriImages other)
        {
            if ((object)other == null || other.GetType() != this.GetType()) return false;
            return this.IdImage == other.IdImage;
        }
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null || obj.GetType() != this.GetType()) return false;
            if (Object.ReferenceEquals(this, obj)) return true;

            var img = obj as ConsiglieriImages;
            if ((object)img == null) return false;
            return this.IdImage == img.IdImage;
        }
        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
        /// </returns>
        public override int GetHashCode()
        {
            return this.IdImage;
        }
        /// <summary>
        /// Implements the operator ==.
        /// </summary>
        /// <param name="a">a.</param>
        /// <param name="b">The b.</param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator ==(ConsiglieriImages a, ConsiglieriImages b)
        {
            if (ReferenceEquals(a, b)) return true;
            if (((object)a == null) || ((object)b == null)) return false;
            return a.Equals(b);
        }
        /// <summary>
        /// Implements the operator !=.
        /// </summary>
        /// <param name="a">a.</param>
        /// <param name="b">The b.</param>
        /// <returns>
        /// The result of the operator.
        /// </returns>
        public static bool operator !=(ConsiglieriImages a, ConsiglieriImages b)
        {
            return !(a == b);
        }
        #endregion
    }
}
